/* 获取药店最新消息 */
var type;
var uid = sessionStorage.getItem("u_group_no");
var name = localStorage.getItem("u_group_name");
$(function () {
	/* 轮播图事件 */
	$('#slide2').swipeSlide({
		autoSwipe:true,//自动切换默认是
		speed:3000,//速度默认4000
		continuousScroll:true,//默认否
		transitionType:'cubic-bezier(0.22, 0.69, 0.72, 0.88)',//过渡动画linear/ease/ease-in/ease-out/ease-in-out/cubic-bezier
		lazyLoad:true,//懒加载默认否
		firstCallback : function(i,sum,me){
			me.find('.dot').children().first().addClass('cur');
		},
		callback : function(i,sum,me){
			me.find('.dot').children().eq(i).addClass('cur').siblings().removeClass('cur');
		}
	});
	
	/* var paramJson = { "actName": "GetIndentM", "rows": "10", "page": "1", "utype": "5", "indent_state": 1, "uid": uid, "bdate": "", "edate":"", "rand": Math.random() };
	ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk); */
	var paramJson = { "actName": "GetIndentM", "rows": "10", "page": "1", "utype": "5", "uid": uid, "indent_status" : 1, "bdate": "", "edate":"", "rand": Math.random() };
	ajaxGet("http://zz.nxk520.com/nethosp/service/nethosp_action.ashx", paramJson, doOk);
	$("#shop_name").html(localStorage.getItem("u_group_name"));
	
	/* 导航点击事件 */
	$("#div_navs").on("click", "a", function(){
		var type = $(this).attr("data-type");
		window.location.href = "shop_prescription_medicine.html?type=" + type;
	});
	
	/* 最新消息的点击事件 */
	$("#shop_news_list").on("click", "a", function(){
		var prescription_id = $(this).attr("data-Pid");
		var indent_no = $(this).attr("data-Iid");
		
		window.location.href = "shop_order_details.html?prescription_id=" + prescription_id + "&indent_no=" + indent_no;
	})
	
	
});

//最新消息
function doOk(rstData) {
	if (rstData.code === "1" && rstData.list.length > 0) {
		
		//生成html片段
		var html = template("shopNewsList",rstData);
		var container = document.getElementById("shop_news_list");
		//将html片段渲染到界面中
		container.innerHTML = html;
	}else{
		//生成html片段
		var html = template("noData",rstData);
		var container = document.getElementById("shop_news_list");
		//将html片段渲染到界面中
		container.innerHTML = html;
	}
}
